package android.demo.library;

import android.app.Service;
import android.content.Intent;
import android.demo.library.model.Library;
import android.os.Binder;
import android.os.IBinder;
import android.widget.Toast;

public class MakeLoanService extends Service {


	@Override
	public IBinder onBind(Intent intent) {
		loanBook(intent);
		return new Binder(){};
	}

	private void loanBook(Intent intent) {
		long bookId= intent.getLongExtra(Library.KEY_ID, 0);
		Library.getInstance().makeLoan(bookId, "Carlo");
	}
	
	@Override
	public boolean onUnbind(Intent intent) {
		return super.onUnbind(intent);
	}

}
